package com.yazdee;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("serial")
public class ProductDetail extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
	throws IOException {
		StringBuffer buffer=new StringBuffer();
		  buffer.append("<Response>");
		if(req.getParameter("type")!=null && ((String)req.getParameter("type")).equals("search")) {
			buffer.append("<product>");
			buffer.append("<name>"+"Wills Lifestyle Eclectic Shirt Dress"+"</name>");
			buffer.append("<SKU>"+"wills-lifestyle-eclectic-shirt"+"</SKU>");
			buffer.append("<price>"+"Rs 2,129.70"+"</price>");
			buffer.append("<imageURL>"+"http://retailmart.com/is-bin/intershop.static/WFS/SellSmart-RetailPortal-Site/SellSmart-RetailPortal/en_US/2009indianseller/thumbnails/Thumbnails_Women_Casual24.gif"+"</imageURL>");
			buffer.append("<productURL>"+"http://retailmart.com/product/wills-lifestyle-eclectic-shirt.html"+"</productURL>");
			buffer.append("</product>");
			
		} else if(req.getParameter("type")!=null && ((String)req.getParameter("type")).equals("category")){
			buffer.append("<product>");
			buffer.append("<name>"+"Testing Client/Server Systems"+"</name>");
			buffer.append("<SKU>"+"testing-client-server-systems"+"</SKU>");
			buffer.append("<price>"+"Rs. 2,497.50"+"</price>");
			buffer.append("<imageURL>"+"http://retailmart.com/is-bin/intershop.static/WFS/SellSmart-RetailPortal-Site/SellSmart-RetailPortal/en_US/delhibookstore/thumbnails/img0070066884.jpg"+"</imageURL>");
			buffer.append("<productURL>"+"http://retailmart.com/product/testing-client-server-systems.html"+"</productURL>");
			buffer.append("</product>");
			
		}
		buffer.append("</Response>");
		resp.setContentType("text/xml");
		
	    resp.getWriter().print(buffer.toString());
			resp.flushBuffer();
	}
}
